<?php
/**
 * Created by PhpStorm.
 * User: kirito
 * Date: 2019/5/17
 * Time: 下午1:47
 */
$zs = [];

$count = 0;
for ($i = 1; $i <= 500; $i++){
    $count++;
    $flag = true;
    for ($j = 2; $j < $i; $j++){
        $count++;
        if ($i % $j == 0){
            $flag = false;
        }
    }

    if ($flag) $zs[] = $i;
}

var_dump($count, $zs);